//
//  main.cpp
//  labuladong
//
//  Created by 刘振舟 on 2023/5/16.
//

#include <iostream>
// #include "linkedList.h"
// #include "arraySolution.hpp"
// #include "dynamic.hpp"
// #include "backtrackSolution.h"
// #include "BFSSolution.hpp"
// #include "SlidingWindows.hpp"
//#include "arraySolution.hpp"
#include "BinaryTree.hpp"


using namespace std;

int main(int argc, const char *argv[])
{

    //    动态规划测试代码
//    	DynamicSolution solution;
//    	vector<int> coins{ 1, 2, 5 };
//    	int result = solution.coinChange(coins, 11);
    	//    cout << "Hello world" << endl;
//    vector<int> nums1{2,7,11,15};
//    vector<int> nums2{1,10,4,11};
//    solution.advantageCount(nums1, nums2);

    //    回溯测试代码
    //    backtrackSolution solution;
    //    vector<int> nums = {1, 2, 3};
    //    solution.subsets(nums);

    //    广度优先遍历测试代码
    //    BFSSolution solution;
    //    TreeNode* root = new TreeNode(1);
    //    root->left = new TreeNode(2);
    //    root->right = new TreeNode(3);
    //    root->right->left = new TreeNode(4);
    //    root->right->right = new TreeNode(5);
    //    cout << "minDepth = " << solution.minDepth(root) << endl;

    //    数组的测试代码
//    Solution solution;
    //      bool result = solution.checkInclusion("abc", "bbbca");
//    vector<vector<int>> trips = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
//    solution.spiralOrder(trips);
    //    vector<int> numbers{2, 7, 11, 15};
    //    solutin.twoSum(numbers, 9);
    //    solutin.longestPalindrome("babad");
    //      solution.carPooling(trips, 3);
    //      cout << result;

    //    链表测试代码
    //    LinkedListSolution solution;
    //    ListNode head1(1);
    //    head1.next = new ListNode(4);
    //    head1.next->next = new ListNode(5);
    //    head1.next->next->next = nullptr;
    //
    //    ListNode head2(1);
    //    head2.next = new ListNode(3);
    //    head2.next->next = new ListNode(4);
    //    head2.next->next->next = nullptr;
    //
    //    ListNode head3(2);
    //    head3.next = new ListNode(6);
    //    head3.next->next = nullptr;
    //
    //    vector<ListNode*> lists({ &head1, &head2, &head3 });
    //    solution.mergeKLists(lists);

    //    ListNode* head = new ListNode(1);
    //    head->next = new ListNode(2);
    //    head->next->next = new ListNode(3);
    //    head->next->next->next = new ListNode(4);
    //    head->next->next->next->next = new ListNode(5);
    //    head->next->next->next->next->next = nullptr;
    //    solution.rotateRight(head, 2);
    //	cout << "Hello world!" << endl;
    
//    滑动窗口测试代码
//    Solution solution;
//    solution.lengthOfLongestSubstring("abcdsfefs");
    
//    二叉树测试代码
    Codec solution;
    TreeNode* root = new TreeNode(1);
    root->left = new TreeNode(2);
    root->right = new TreeNode(3);
    root->left->left = nullptr;
    root->left->right = nullptr;
    root->right->left =  new TreeNode(4);
    root->right->right = new TreeNode(5);
    string res = solution.serialize(root);
    TreeNode* node = solution.deserialize(res);
    cout << res;
    return 0;
}
